Using Nice Menus for Drop-Down Primary Links

Events happening in the community are now at Drupal community events on www.drupal.org.
irakli's picture

Quick-n-dirty tutorial for using Nice Menus with OpenPublish to create drop-down menus.

Note: this functionality will become part of OpenPublish in one of the upcoming releases and you won't have to do anything manually.

  • Create sub-menus for the primary menu through menu administration interface.
  • Download and install Nice Menus: http://drupal.org/project/nice_menus
  • Edit .info file of your OP theme and add a region like:
    regions[primary_menu] = Primary Menu
  • Edit page/page.header.inc under your OP theme folder and replace the following line:
          <?php print theme('links', $primary_links, array('class' => 'links primary-links')) ?>

    with:

          <?php //print theme('links', $primary_links, array('class' => 'links primary-links')) ?>
          <?php print $primary_menu; ?>
  • Clear cache, e.g. by calling: http://yourdomain.com/devel/cache/clear (if you have devel module still installed, or use drush or clear cache tables from the database)
  • Edit sitewide context by going to: http://yourdomain.com/admin/build/context/2 and add "Nice Menu1" block to the Primary Links region.
  • Edit "Nice Menu 1" block by going to: http://yourdomain.com/admin/build/block/configure/nice_menus/1 and set following settings:
    • Source Menu Tree: Primary Links
    • Menu Style: down
  • Save block configuration (do not enable block from the block admin page, though. Blocks are enable through context in OP).
  • Clear cache, e.g. by calling: http://yourdomain.com/devel/cache/clear

You will most probably need to further style Nice Menu-generated menu via CSS to make it look better/the way you want.

Comments

andrewtberman's picture

Thank you VERY much for the response last night. Really appreciate it.

So I added the region to the openpublish_theme.info file, THEN, replaced the text in the page.header.inc file.

I then went to edit the Sitewide Context and the Primary Links region does not show up (see attached). While I know I am NOT suppose to enable from Blocks, I just went to blocks to see if the region was there, and it was not.

Also, what areas of the CSS apply to the menu?

Thanks again for your help.

Sorry, I must have forgotten

irakli's picture

Sorry, I must have forgotten one step - once you add region to the .info file - you need to clear cache, since .info file settings are cached.

.............................................
http://twitter.com/inadarei

Assumed that...

andrewtberman's picture

Thank you for the response. I actually assumed that was the case and did clear the cache. I even did it another time, just to be sure, and still the Primary Links region is not showing. :(

Can you copy the contents of

irakli's picture

Can you copy the contents of the active theme's .info file here, please?

.............................................
http://twitter.com/inadarei

Here you go...

andrewtberman's picture

name = OpenPublish
description = OpenPublish Default Theme.
version = VERSION
core = 6.x
engine = phptemplate

; CSS styles for default HTML elements.
stylesheets[all][] = css/html-elements.css

; CSS file exclusively for floats, dimensions and other layout-related styles
stylesheets[all][] = css/layout.css

; CSS file companion to layout.css, to add any other (typeface) styles to the same elements
stylesheets[all][] = css/template.css

; CSS file to style re-usable components that can appear unde multiple mockups/contexts.
stylesheets[all][] = css/components.css

; Wysiwyg-editor styles
stylesheets[all][] = css/editor.css

; Print-version styles
stylesheets[print][] = css/print.css

regions[primary_menu] = Primary Menu
regions[left] = Left Sidebar
regions[right] = Right Sidebar
regions[over_content] = On Top of Content
regions[under_content] = Underneath the Content
regions[header] = Header
regions[footer] = Footer

; Information added by drupal.org packaging script on 2009-12-02
version = "6.x-1.6-rc1"
core = "6.x"
project = "openpublish_theme"
datestamp = "1259713250"

The .info file looks fine.

irakli's picture

The .info file looks fine. Considering it is part of the proper theme and cache clearing works properly - you should be seeing the new region in the context administration page.

Just as a sanity check, I would switch to some other theme and switch back to the OP theme and see what happens. Even though you should not need to do that, but just to make sure something is not acting goofy.

.............................................
http://twitter.com/inadarei

Odd...that worked!!!

andrewtberman's picture

You rock! That worked.

Trying This With The Simplex 2 Theme

spicynumber1's picture

irakli,

Do you think this procedure would work with the Simplex 2 Theme. I ask because I am in the same boat as andrewtberman—new to Drop down Menus in Drupal. Trying Nice Menus, but getting very confused by the several different approaches online forums suggest for this module. One detail, there is no page.header.inc in the Simplex 2 theme, so when I tried your approach in the page.tpl.php page (because I found code similar to what you listed in that file), all of my navigation bars disappeared. Any suggestions on where to start with primary link drop downs with the Simplex 2 Theme?

Rockin'

pixelsweatshop's picture

It worked. Thanks for this.

OpenPublish

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week